home *** CD-ROM | disk | FTP | other *** search
- QUESTION: Whenever I attempt to use getvec() in a C++ program I get
- compiler errors. What am I doing wrong?
-
- ANSWER: A minor difference in the way ANSI C and C++ treat empty
- declaration lists on functions cause trouble for the example
- programs in TC++ 1.0.
-
- In ANSI C the declaration:
-
- void func();
-
- indicates that func is a function which returns nothing
- and may take a variable number of arguments. In the C++
- language, this is a function which returns nothing and
- takes nothing.
-
- This brings a problem out with the DOS.H header file in
- regards to the functions getvect() and setvect(). The
- prototype for these functions is conditionally compiled to
- allow variable length lists in both languages. What this
- means is that the example for setvect in the help system for
- TC++ 1.0 does not work in C++.
-
- The problem is in the declaration of the interrupt function:
-
- void interrupt func(void) {}
- void interrupt (*fptr)(void);
-
- The void in the parenthesis is OK in ANSI C, but must be
- changed to elipsis in C++ for the examples to compile.
-
- void interrupt func(...) {}
- void interrupt (*fptf)(...);
-